This tutorials shows how to add View in the shape of the Capsule.
Capsule draws a box where longer dimensions is fully rounded.
You can't combine fill and stroke on the same Capsule.
Fill
struct ContentView : View {
var body : some View {
Capsule()
.rotation(.degrees(45))
.fill(Color.green)
.frame(width: 100, height: 50)
}
}
Stroke
struct ContentView : View {
var body : some View {
Capsule()
.rotation(.degrees(45))
.stroke(Color.green, lineWidth: 2)
.frame(width: 100, height: 50)
}
}
Fill Stroke